home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 2 / MacMania 2.toast / Demo's / Tools&Utilities / Programming / File Dropper 1.1b1 / FD Starter / Starter Main.c < prev   
Encoding:
C/C++ Source or Header  |  1993-04-17  |  2.1 KB  |  72 lines  |  [TEXT/KAHL]

  1. #include "FD Interface.h"
  2.  
  3. /*****
  4.  * This is the module's main entrypoint.
  5.  *****/
  6. Boolean ModuleMain( short message, ModuleDataRec *moduleData)
  7. {
  8.     switch (message)
  9.     {
  10.         case eStartup    :
  11.             // The application just started.  Set up any custom stuff you want.
  12.             SetStatusParams( TRUE, TRUE, "\pMoof!");
  13.             break;
  14.             
  15.         case eSFInitialize    :
  16.             // The SFGetFile is about to be brought up - you can install your own at this point
  17.             // if you want to.
  18.             // If the user chooses a file, you will receive one each of eValidate and eProcessFile
  19.             // messages.  If s/he chooses a folder, you will receive an eValidate and eProcessFile
  20.             // message for each file in the folder, and each file in each folder on down the line.
  21.             // NOTE: you only get one of these for each time the SFGetFile dialog comes up.  If 
  22.             // you want to initialize something before each file, do it in the eProcessFile case.
  23.             break;
  24.                 
  25.         case eAEInitialize    :
  26.             // An 'odoc' AppleEvent has been received - you are about to be flooded with 
  27.             // eValidateFile and eProcessFile messages (a set for each file you need to process)
  28.             // NOTE, you only get one eAEInitialize for the whole batch of files.  If you want to
  29.             // initialize something before each file, do it in the eProcessFile case.
  30.             break;
  31.              
  32.         case eValidateFile    :
  33.             // return TRUE if theFile in moduleData is one that you want to process, FALSE otherwise
  34.             break;
  35.             
  36.         case eProcessFile    :
  37.             // Do your stuff - theFile in moduleData is the file you need to process
  38.             // Here, I simply am showing off the progress bar stuff.
  39.             {
  40.                 short    i;
  41.                 
  42.                 for ( i=0; i <= 50; i++) SetStatusPercentage( i);    
  43.                 
  44.                 for ( ; i >= 25; i--) SetStatusPercentage( i);    
  45.                 
  46.                 for ( ; i <= 100; i++) SetStatusPercentage( i);    
  47.             }
  48.             break;
  49.             
  50.         case eDispose        :
  51.             // If you allocated any storage in eSFInitialize or eAEInitialize, dispose of it here.
  52.             break;
  53.         
  54.         case eDoAboutBox    :
  55.             // Give yourself some credit.
  56.             break;
  57.         
  58.         case eQuitting        :
  59.             // The application is about to quit, save anything that needs to be saved.
  60.             break;
  61.     }
  62.     
  63.     return TRUE;    // This is actually ignored except as a result of the eValidateFile message.
  64. }
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.